home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Redirect_JScript.asp < prev    next >
Encoding:
Text File  |  1998-05-29  |  1.2 KB  |  50 lines

  1. <%@ Language = JScript %>
  2.  
  3. <!*************************
  4. This sample is provided for educational purposes only. It is not intended to be 
  5. used in a production environment, has not been tested in a production environment, 
  6. and Microsoft will not provide technical support for it. 
  7. *************************>
  8.  
  9. <%
  10.     //Because we might be redirecting, we must use buffering.
  11.     Response.Buffer = true;
  12. %>
  13.  
  14. <HTML>
  15.     <HEAD>
  16.         <TITLE>Redirect Sample</TITLE>
  17.     </HEAD>
  18.  
  19.     <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
  20.         
  21.         <!-- Display header. -->
  22.  
  23.         <FONT SIZE="4" FACE="ARIAL, HELVETICA">
  24.         <B>Redirect Sample</B></FONT><BR>   
  25.  
  26.         <%
  27.             //If the referring page did not come
  28.             //from the sight "trainer3", Redirect
  29.             //the user to www.microsoft.com.
  30.             var referer = String(Request.ServerVariables("HTTP_REFERER"));
  31.             var intIndex ;
  32.  
  33.             if ((intIndex = referer.indexOf("trainer3", 0)) >= 0) 
  34.             {
  35.                 //They came from within the trainer3
  36.                 //web site so we let them continue.
  37.             }
  38.             else
  39.             {
  40.                 //They just linked from outside of the site.
  41.                 Response.Redirect("http://www.microsoft.com");
  42.             }
  43.  
  44.  
  45.             //Flush Response Buffer.
  46.             Response.Flush();
  47.         %>
  48.     </BODY>
  49. </HTML>
  50.